﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MVCExtension.FrameWork;

namespace MVCExtension.Menu
{
   public class menu
    {
        public static string MakeMenuTree()
        {
            //将tempwords处理到缓存中

            string tempwords = string.Empty;
            tempwords = "<script type='text/javascript'> d = new dTree('d'); d.add(0, -1, '操作导航');";

            //处理到缓存中

            DataTable dt = DBHelper.GetDataTable("select * from menulist  order by paixu desc,id asc ");
            foreach (DataRow dr in dt.Rows)
            {

                if (dr["power"].ToString().Contains(MasterHelper.UsergroupId) || dr["power"].ToString() == "")
                {
                    tempwords += "	d.add(" + dr["id"] + ", " + dr["ParentID"] + ", '" + dr["context"] + "', '" + dr["link"] + "','" + dr["context"] + "','mainFrame');";
                }
            }


            tempwords += "  document.write(d);</script>";


            return tempwords;

        }
    }
    
}
